<template>

	<view class="main">
		<u-navbar :fixed="false" :bgColor="bgColor" title="影像记录" @rightClick="rightClick" :autoBack="true"></u-navbar>

		<z-paging ref="paging" v-model="dataList" @query="queryList" usePageScroll>
			<view class=" column_c">
				<view class="card-content" @click="toUrlYyyq(item.id)" v-for="(item, index) in dataList" :key="index">
					<view class="row_a_c space-between">
						<text class="clinic">{{item.created_at}}</text>
						<text class="status success center" v-if="item.type==1">初诊病历</text>
						<text class="status success center" v-if="item.type==2">复诊病历</text>
					</view>
					<view class="appointment-info">
						<view class="name">医生：{{item.doctor.name}}</view>
						<view class="time">诊断：{{item.diagnosis}}</view>
						<view class="time">处置：{{item.treatment}}</view>
					</view>
				</view>
			</view>
		</z-paging>
		
		<!-- <view class="ttbb" @click="toUrl('/pages/patient/video-upload ')">
			<image class="tj" src="/static/images/tj.png"></image>
		</view> -->

	</view>

</template>

<script>
	import api_silhouette from '@/api/silhouette.js';
	import ZPMixin from '@/uni_modules/z-paging/components/z-paging/js/z-paging-mixin';

	export default {
		mixins: [ZPMixin],
		async onLoad(option) {
			this.user = option.id;
		},

		async onShow() {
			this.access_token = uni.getStorageSync('access_token');
			if (!this.access_token) {
				uni.navigateTo({
					url: '/pages/auth/login'
				});
			} else {
				// this.getScreenageUserListFuc(); // 查看患者影像记录
			}
		},

		data() {
			return {
				access_token: null,
				bgColor: 'rgba(0, 31, 63, 0)',
				dataList: []
			};
		},

		methods: {




			toUrlYyyq(id) {
				uni.navigateTo({
					url: '/pages/patient/video-info?id=' + id
				});
			},


			async queryList(pageNo, pageSize) {

				var per = {
					no_page: pageNo,
					page_size: pageSize,
					user: this.user,
				}

				const res = await api_silhouette.getScreenageUserList(per);
				if (res.code == 1) {
					this.$refs.paging.complete(res.data.list);
				} else {
					this.$refs.paging.complete(false);
				}

			},

			//查看患者影像记录
			// async getScreenageUserListFuc() {
			// 	var per = {
			// 		user: this.user,
			// 		no_page: 1,
			// 		page_size: 10
			// 	}
			// 	const res = await api_silhouette.getScreenageUserList(per);
			// 	if (res.code == 1) {
			// 		this.dataList = res.data.list
			// 	} else {
			// 		this.$util.msg(res.message);
			// 		return;
			// 	}
			// },

			toUrl(url) {
				this.navTo(url);
			},
		}
	};
</script>

<style scoped lang="scss">
	.main {
		background: #FAFAFA;
		height: 100vh;
	}

	.bit {
		padding: 32rpx;
	}

	.but {
		width: 290rpx;
		height: 60rpx;
		background: #FFFFFF;
		border-radius: 50rpx 50rpx 50rpx 50rpx;
		padding: 0 30rpx;
	}

	.time {
		font-weight: 400;
		font-size: 28rpx;
		color: #7F7F7F;
	}

	.xltb {
		width: 32rpx;
		height: 32rpx;
	}


	.container {
		padding: 0;
	}

	.card {
		background-color: #fff;
		border-radius: 8px;
		box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
		margin-bottom: 20px;
	}

	.card-header {
		display: flex;
		justify-content: space-between;
		padding: 10px;
		border-bottom: 1px solid #f0f0f0;
	}

	.status {
		font-weight: 400;
		font-size: 24rpx;
		color: #27CCBB;
	}


	.cancelled {
		color: #f44336;
	}

	.card-content {
		width: 686rpx;
		min-height: 250rpx;
		background: #FFFFFF;
		box-shadow: 0rpx 0rpx 8rpx -2rpx rgba(0, 0, 0, 0.04), 0rpx 0rpx 10rpx 0rpx rgba(0, 0, 0, 0.03), 0rpx 0rpx 20rpx 0rpx rgba(0, 0, 0, 0.02);
		border-radius: 20rpx 20rpx 20rpx 20rpx;
		padding: 32rpx;
		// margin-bottom: 20rpx;
		margin-top: 30rpx;
	}

	.clinic {
		font-weight: bold;
		font-size: 28rpx;
		color: rgba(0, 0, 0, 0.85);


	}

	.name {

		font-weight: 400;
		font-size: 24rpx;
		color: rgba(0, 0, 0, 0.6);
		margin-bottom: 12rpx;

	}

	.time {
		font-weight: 400;
		font-size: 24rpx;
		color: rgba(0, 0, 0, 0.6);
		margin-bottom: 12rpx;
	}


	.appointment-info {
		margin-top: 20rpx;
	}
	
	
	.tj {
		width: 166rpx;
		height: 168rpx;
	}
	
	.ttbb {
		position: fixed;
		bottom: 100rpx;
		right: 20rpx;
	}
</style>